package com.think.teaching.service.impl;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.think.teaching.mapper.UserMapper;
import com.think.teaching.model.User;

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User>{
	
	
	public User CheckAndInitUser(Integer id,String nickname,String name,String avatar,String email) {
		if(getById(id)==null) {
			User user = new User();
			user.setId(id);
			user.setNickname(nickname);
			user.setName(name);
			user.setAvatarUrl(avatar);
			user.setEmail(email);//(name);
			this.save(user);
			return user;
		}
		return getById(id);
		
	}
}
